package com.ruoyi.tongyan.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.tongyan.service.TReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/tongyan/review/declaration")
public class TDeclarationReviewController extends BaseController {

    @Autowired
    private TReviewService tReviewService;

    /**
     * 申报和专家评审关联
     * @param declarationIds
     * @param userId
     * @return
     */
    @PostMapping("/{declarationIds}/{userId}")
    public AjaxResult assignExpert(@PathVariable Long[] declarationIds, @PathVariable Long userId){
        return toAjax(tReviewService.assignDeclaration(declarationIds,userId));
    }

    /**
     * 专家通过申报
     * @param declarationId
     * @return
     */
    @PostMapping("/pass/{declarationId}")
    public AjaxResult passDeclaration(@PathVariable Long declarationId){
        return toAjax(tReviewService.passDeclaration(declarationId));
    }

    /**
     * 专家未通过申报
     * @param declarationId
     * @return
     */
    @PutMapping("/reject/{declarationId}")
    public AjaxResult rejectDeclaration(@PathVariable Long declarationId){
        return toAjax(tReviewService.rejectDeclaration(declarationId));
    }
}
